package com.taotao.wifepojie.controller;

import com.taotao.wifepojie.entity.UserEntity;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * @author wangjin
 * @title: IndexController
 * @projectName wife-pojie
 * @description: TODO
 * @date 2022/4/18 0018 9:32
 */
@Controller
public class IndexController {
    @RequestMapping("/index")
    public String index(Map modelMap){
        modelMap.put("name","你好");

        //不用加后缀因为配置文件已经加了后缀
        return "index";
    }
    @RequestMapping("/freemarkerIndex")
    public String freemarkerIndex(Map<String, Object> result) {
        result.put("name", "21212");
        result.put("sex", "0");
        List<String> listResult = new ArrayList<String>();
        listResult.add("zhangsan");
        listResult.add("lisi");
        listResult.add("ewewe");
        result.put("listResult", listResult);
        return "freemarkerIndex";
    }
    @RequestMapping("/myThymeleaf")
    public String myThymeleaf(Map<String, Object> result) {
        result.put("user", new UserEntity("mayikt", 22));

        return "myThymeleaf";
    }

}
